package com.example.doctor.controller;

import com.example.common.support.Result;
import com.example.doctor.dto.req.*;
import com.example.doctor.dto.resp.*;
import com.example.doctor.service.TempleteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author sifan
 * @PackagName:com.example.doctor.controller
 * @ClassName: TempleteController
 * @Description:
 * @date:2021/1/22 13:44
 */
@RestController
@Api(tags = "模板列表")
@RequestMapping("/api/Templete")
public class TempleteController {

    @Resource
    TempleteService templeteService;

    @ApiOperation(value = "模板 列表")
    @PostMapping("/List")
    public Result<Map<String,Object>> List(@RequestBody TempleteListReq templeteListReq){
        Map<String ,Object> templeteListRsp =   templeteService.List(templeteListReq);
        return Result.success(templeteListRsp);
    }

    @ApiOperation(value = "中医模板 选择项")
    @PostMapping("/SelectZKeys")
    public Result<HashMap<String,Object>> SelectZKeys(){
        HashMap<String,Object> hashMap = templeteService.SelectZKeys();
        return Result.success(hashMap);
    }

    @ApiOperation(value = "中医模板 药品搜索")
    @PostMapping("/SearchZDrug")
    public Result<List<SearchZDrugRsp>> SearchZDrug(@RequestBody SearchZDrugReq searchZDrugReq){
        List<SearchZDrugRsp> searchZDrugReqList = templeteService.SearchZDrug(searchZDrugReq);
        return Result.success(searchZDrugReqList);
    }

    @ApiOperation(value = "中医模板 保存")
    @PostMapping("/SaveZTemplete")
    public Result<HashMap<String,Object>> SaveZTemplete(@RequestBody SaveZTempleteReq saveZTempleteReq){
        HashMap<String,Object> hashMap = templeteService.SaveZTemplete(saveZTempleteReq);
        return Result.success(hashMap);
    }

    @ApiOperation(value = "中医模板 模板详情")
    @PostMapping("/ZInfo")
    public Result<ZInfoRsp> ZInfo(@RequestBody ZInfoReq zInfoReq){
        ZInfoRsp zInfoRsp = templeteService.ZInfo(zInfoReq);
        return Result.success(zInfoRsp);
    }

    @ApiOperation(value = "中医模板 删除")
    @PostMapping("/DelZTemplete")
    public Result<HashMap<String,Object>> DelZTemplete(@RequestBody DelZTempleteReq delZTempleteReq){
        HashMap<String,Object> hashMap = templeteService.DelZTemplete(delZTempleteReq);
        return Result.success(hashMap);
    }

    @ApiOperation(value = "模板 选择项")
    @PostMapping("/SelectXKeys")
    public Result<HashMap<String,Object>> SelectXKeys(){
        HashMap<String,Object> hashMap = templeteService.SelectXKeys();
        return Result.success(hashMap);
    }

    @ApiOperation(value = "模板 搜索疾病")
    @PostMapping("/SearchDisease")
    public Result<List<SearchXDiseaseRsp>> SearchXDisease(@RequestBody SearchXDiseaseReq searchXDiseaseReq){
        List<SearchXDiseaseRsp> searchZDrugRspList = templeteService.SearchXDisease(searchXDiseaseReq);
        return Result.success(searchZDrugRspList);
    }

    @ApiOperation(value = "模板 药品搜索")
    @PostMapping("/SearchXDrug")
    public Result<List<SearchXDrugRsp>> SearchXDrug(@RequestBody SearchXDrugReq searchXDrugReq){
        List<SearchXDrugRsp> searchXDrugRspList = templeteService.SearchXDrug(searchXDrugReq);
        return Result.success(searchXDrugRspList);
    }

    @ApiOperation(value = "模板 保存")
    @PostMapping("/SaveXTemplete")
    public Result<HashMap<String,Object>> SaveXTemplete(@RequestBody SaveXTempleteReq saveXTempleteReq){
        HashMap<String,Object> hashMap =templeteService.SaveXTemplete(saveXTempleteReq);
        return Result.success(hashMap);
    }

    @ApiOperation(value = "模板 模板详情")
    @PostMapping("/XInfo")
    public Result<XInfoRsp> XInfo(@RequestBody XInfoReq xInfoReq ){
        XInfoRsp xInfoRsp = templeteService.XInfo(xInfoReq);
        return Result.success(xInfoRsp);
    }

    @ApiOperation(value = "模板 删除")
    @PostMapping("/DelXTemplete")
    public Result<HashMap<String,Object>> DelXTemplete(@RequestBody DelXTempleteReq delXTempleteReq){
        HashMap<String,Object> hashMap = templeteService.DelXTemplete(delXTempleteReq);
        return Result.success(hashMap);
    }

}
